$OpenBSD: patch-src_memory_c,v 1.1 2011/03/14 22:27:02 jasper Exp $

Fix buffer overflow due to incorrect strncat() usage.
http://savannah.nongnu.org/bugs/?29049

--- src/memory.c.orig	Mon Mar 14 23:22:55 2011
+++ src/memory.c	Mon Mar 14 23:25:21 2011
@@ -424,7 +424,7 @@ mem_sram_display (Memory *mem, FILE * f_core, int base
             line[0] = '\0';
         }
         snprintf (buf, 80, "%02x ", mem_read (mem, i));
-        strncat (line, buf, 80);
+        strncat (line, buf, 80 - strlen(line) - 1);
     }
     if (dup > 0)
     {
